﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MethodWorx.CMS.Content;
using Moq;
using MethodWorx.CMS.UI.Controllers;
using MethodWorx.CMS.UI.Tests.Doubles;
using MethodWorx.CMS.UI.Models;
using MethodWorx.CMS.UI.Models.Shared;
using System.ComponentModel.DataAnnotations;
using MethodWorx.CMS.Requests;
using MethodWorx.Core.DomainModel;

namespace MethodWorx.CMS.UI.Tests.ContentTemplates
{
    [TestClass]
    public class ConfigureContentTemplateControllerTests
    {
        [TestMethod]
        public void Ensure_BasicDetails_Reads_Correct_ContentTemplate()
        {
            /*Guid id;
            var mock = Mock.Get(this.CreateRequest(out id));

            ConfigureContentTemplateController controller = new ConfigureContentTemplateController(mock.Object);
            controller.BasicDetails(id);
            mock.Verify();*/
        }

        [TestMethod]
        public void Ensure_BasicDetails_Returns_Name_And_Description()
        {
            /*Guid id;
            var mock = Mock.Get(this.CreateRequest(out id));

            ConfigureContentTemplateController controller = new ConfigureContentTemplateController(mock.Object);
            var result = controller.BasicDetails(id);

            TestHelper.AssertIsViewResult(result, "BasicDetails");
            var model = TestHelper.AssertResultContainsModel<ConfigureContentTemplateModel>(result);

            Assert.IsTrue(model.UpdateRequest.Name == "Name", "Name not present in model");
            Assert.IsTrue(model.UpdateRequest.Description == "Description", "Description not present in model");*/
        }

        [TestMethod]
        public void Ensure_Invalid_BasicDetails_Returns_Model()
        {
            //Assert.Inconclusive();
            //
            //  service
            /*Guid id;
            var mock = Mock.Get(this.CreateRequest(out id));
            //  posted details
            var ctbd = new UpdateContentTemplateBasicDetailsRequestDouble();

            //
            //  controller
            ConfigureContentTemplateController controller = new ConfigureContentTemplateController(mock.Object);
            controller.ModelState.AddModelError("Invalid", "Invalid");
            //  action
            var result = controller.BasicDetails(id, ctbd);

            TestHelper.AssertIsViewResult(result, "BasicDetails");
            Assert.IsTrue(TestHelper.AssertResultContainsModel<ConfigureContentTemplateModel>(result).UpdateRequest == ctbd);*/
        }

        [TestMethod]
        public void Ensure_ContentTemplateBasicDetails_Name_IsRequired()
        {
            TestHelper.AssertModelContainsRequiredValidationAttribute<UpdateContentTemplateBasicDetailsRequest, string>(
                m => m.Name, 
                "Please enter a content template name");
        }

        [TestMethod]
        public void Ensure_Valid_BasicDetails_Updates_The_Domain_Model()
        {
            //Assert.Inconclusive();
        }

        [TestMethod]
        public void Ensure_BasicDetails_Reports_BusinessRuleException()
        {
            //Assert.Inconclusive();
        }
    }
}
